/**
* uncompleteFormChart functions
* copyright@Catosoft.com reserved, 2016
* 2016.07.25, created by Eric.Wang
*/


/*
* get data
*/
var getUncompleteInputData = function(){
	var data = {
		type: 1,
	};
	var option = {
		url: '/draft/table/special/v1',
		type: 'GET',
		data: data,
	};
	createAjax(option, function(err, res){
		if(!err){
			uncompleteInputTable('uncompleteInputTable', res);
		}
	});
}

var getUncompleteCheckData = function(){
	var data = {
		type: 2,
	};
	var option = {
		url: '/draft/table/special/v1',
		type: 'GET',
		data: data,
	};
	createAjax(option, function(err, res){
		if(!err){
			uncompleteCheckTable('uncompleteCheckTable', res);
		}
	});
}

var getUncompleteAuditData = function(){
	var data = {
		type: 3,
	};
	var option = {
		url: '/draft/table/special/v1',
		type: 'GET',
		data: data,
	};
	createAjax(option, function(err, res){
		if(!err){
			uncompleteAuditTable('uncompleteAuditTable', res);
		}
	});
}

var getUncompleteLockData = function(){
	var data = {
		type: 4,
	};
	var option = {
		url: '/draft/table/special/v1',
		type: 'GET',
		data: data,
	};
	createAjax(option, function(err, res){
		if(!err){
			uncompleteLockTable('uncompleteLockTable', res);
		}
	});
}
/*
* draw charts
*/
var uncompleteInputTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: data.list,
		classes: 'table table-hover',
		pagination: true,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		buttonsAlign: 'right',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '中心',
			field: 'name',
		}, {
			title: '受试者标签',
			field: 'label',
		}, {
			title: '访视期',
			field: 'periodname',
		}, {
			title: '表单',
			field: 'tablename',
		}],

	});
}

var uncompleteCheckTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: data.list,
		classes: 'table table-hover',
		pagination: true,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		buttonsAlign: 'right',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '中心',
			field: 'name',
		}, {
			title: '受试者标签',
			field: 'label',
		}, {
			title: '访视期',
			field: 'periodname',
		}, {
			title: '表单',
			field: 'tablename',
		}],

	});
}

var uncompleteAuditTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: data.list,
		classes: 'table table-hover',
		pagination: true,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		buttonsAlign: 'right',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '中心',
			field: 'name',
		}, {
			title: '受试者标签',
			field: 'label',
		}, {
			title: '访视期',
			field: 'periodname',
		}, {
			title: '表单',
			field: 'tablename',
		}],

	});
}

var uncompleteLockTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: data.list,
		classes: 'table table-hover',
		pagination: true,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		buttonsAlign: 'right',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '中心',
			field: 'name',
		}, {
			title: '受试者标签',
			field: 'label',
		}, {
			title: '访视期',
			field: 'periodname',
		}, {
			title: '表单',
			field: 'tablename',
		}],

	});
}


$(function(){
	getUncompleteInputData();
	getUncompleteCheckData();
	getUncompleteAuditData();
	getUncompleteLockData();
});